<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html>
	<head>
		<title>编辑用户</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">
			$(function() {
				//初始化表单验证
				$("#inputForm").initValidform();
			});
		</script>
	</head>
	
	<body class="mainbody">
		<form:form id="inputForm" modelAttribute="user" action="${ctx}/sys/user/save" method="post" class="form-horizontal">
			<form:hidden path="id"/>
			<!--导航栏-->
			<div class="location">
				<a href="${ctx}/sys/user/list" class="back"><i></i><span>返回列表页</span></a>
				<a href="${ctx}/center" class="home"><i></i><span>首页</span></a> 
				<i class="arrow"></i> 
				<a href="${ctx}/sys/user/"><span>用户管理</span></a>
				<shiro:hasPermission name="sys:student:edit"><i class="arrow"></i><span>${not empty user.id ? '修改':'添加' }用户</span></shiro:hasPermission>
			</div>	
			<div class="line10"></div>
			<!--/导航栏-->
	
			<!--内容-->
			<div id="floatHead" class="content-tab-wrap">
				<div class="content-tab">
					<div class="content-tab-ul-wrap">
						<ul>
							<li><a class="selected" href="javascript:;">用户信息</a></li>
						</ul>
					</div>
				</div>
			</div>
	
			<div class="tab-content">
				<dl>
					<dt>登录名</dt>
					<dd>
						<c:choose>
							<c:when test="${not empty user.id}">
						<form:input path="loginName" htmlEscape="false" maxlength="50" readonly="true" class="required" cssClass="input normal" datatype="*" nullmsg="请输入登录名" errormsg="请输入登录名" sucmsg=" "/>
							</c:when>
							<c:otherwise>
						<form:input path="loginName" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" ajaxurl="${ctx}/sys/user/ajax?method=user_validate" nullmsg="请输入登录名" errormsg="请输入登录名" sucmsg=" "/>
							</c:otherwise>
						</c:choose>
						<span class="Validform_checktip">*字母、下划线，不可修改</span>
					</dd>
				</dl>
				<dl>
					<dt>登录密码</dt>
					<dd>
						<c:choose>
							<c:when test="${not empty user.id}">
						<input type="password"  name="password" value="${defaultpassword}" class="input normal" datatype="*6-20" nullmsg="请输入密码" errormsg="密码范围在6-20位之间" sucmsg=" "/>
							</c:when>
							<c:otherwise>
						<input type="password" name="password" class="input normal" datatype="*6-20" nullmsg="请输入密码" errormsg="密码范围在6-20位之间" sucmsg=" "/>
							</c:otherwise>
						</c:choose>
						<span class="Validform_checktip">*密码范围在6-20位之间（不修改，保持为空）</span>
					</dd>
				</dl>
				<dl>
					<dt>确认密码</dt>
					<dd>
						<c:choose>
							<c:when test="${not empty user.id}">
						<input type="password" name="password1" value="${defaultpassword}" class="input normal" recheck="password" datatype="*6-20" nullmsg="请再输入一次密码" errormsg="两次输入的密码不一致" sucmsg=" "/>
							</c:when>
							<c:otherwise>
						<input type="password" name="password1" class="input normal" recheck="password" datatype="*6-20" nullmsg="请再输入一次密码" errormsg="两次输入的密码不一致" sucmsg=" "/>
							</c:otherwise>
						</c:choose>
						
						<span class="Validform_checktip">*</span>
					</dd>
				</dl>
				<dl>
					<dt>工号</dt>
					<dd>
						<form:input path="no" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入工号" errormsg="请输入工号" sucmsg=" "/>
						<span class="Validform_checktip">*</span>
					</dd>
				</dl>
				<dl>
					<dt>姓名</dt>
					<dd>
						<form:input path="name" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入姓名" errormsg="请输入姓名" sucmsg=" "/>
						<span class="Validform_checktip">*</span>
					</dd>
				</dl>
				<dl>
					<dt>手机</dt>
					<dd>
						<form:input path="mobile" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入手机" errormsg="请输入手机" sucmsg=" "/>
						<span class="Validform_checktip">*</span>
					</dd>
				</dl>
				<dl>
					<dt>邮箱</dt>
					<dd>
						<form:input path="email" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请输入邮箱" errormsg="请输入邮箱" sucmsg=" "/>
						<span class="Validform_checktip">*</span>
					</dd>
				</dl>
				<dl>
					<dt>可登录</dt>
					<dd>
						<div class="rule-multi-radio">
							<div class="rule-multi-radio">
							    <form:radiobutton path="loginFlag"  value="0"  label="否" checked="checked" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请选择是否中奖" errormsg="请选择是否中奖" sucmsg=" "/>
							    <form:radiobutton path="loginFlag"  value="1"  label="是" htmlEscape="false" maxlength="50" class="required" cssClass="input normal" datatype="*" nullmsg="请选择是否中奖" errormsg="请选择是否中奖" sucmsg=" "/>
							</div>
					    </div>
					</dd>
				</dl>
				<dl>
					<dt>用户角色</dt>
					<dd>
						<div class="rule-multi-porp">
							<c:forEach items="${roleList}" var="role">
								<input name="role" class="input normal" maxlength="50" value="${role.id}" <c:if test="${role.checked}">checked="checked"</c:if> type="checkbox">
								<label for="role">${role.name}</label>
							</c:forEach>
						</div>
						<span class="Validform_checktip"></span>
					</dd>
				</dl>
			</div>
			<!--/内容-->
	
			<!--工具栏-->
			<div class="page-footer">
				<div class="btn-wrap">
					<input type="submit" name="btnSubmit" value="提交保存" id="btnSubmit" class="btn" /> 
					<input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript:history.back(-1);" />
				</div>
			</div>
			<!--/工具栏-->
		</form:form>
	</body>
</html>

